from django.conf.urls import url
from . import views
urlpatterns=[
    # weather/beijing/2018
    # 演示匹配逻辑
    #url(r'^weather/[a-z]+/\d{4}/$',views.weather)
    # 利用正则组来提取URL参数-位置参数
    #url(r'^weather/([a-z]+)/(\d{4})/$',views.weather)
    # 利用正则分组起别名，来提取URL参数-关键字参数
    url(r'^weather/(?P<city>[a-z]+)/(?P<year>\d{4})/$', views.weather),
    # 演示提取字符串
    url(r'^query_str/$',views.query_str),
    # 演示提取请求体中的取表单
    url(r'^body_form/$',views.body_form),
    # 演示提取请求体中的非表单数据
    url(r'^body_json/$',views.body_json),
    # 演示提取请求信息
    url(r'^request_head/$',views.request_head),
    # 演示响应常规操作
    url(r'^response_demo/$',views.response_demo),
    # 演示响应json数据
    url(r'^response_json/$',views.response_json),
    # 演示命名空间和反向解析，name参数表示给路由起一个别名
    url(r'^reverse_demo/$',views.reverse_demo,name='reverse_demo'),
    # 演示重定向
    url(r'^redirect_demo/$',views.redirect_demo),
    # cookie缓存读写
    url(r'^cookie_demo/$',views.cookie_demo),
    # 演示session读取
    url(r'^session_demo/$',views.session_demo),
]